﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 遗传算法测试
{
    public partial class ShowForm : Form
    {
        public ShowForm()
        {
            InitializeComponent();

            ClientSize = new Size(300, 300);

            TopLevel = false;
        }

        public Label[,] labels = new Label[6, 6];

        private void Init()
        {
            for(int i = 0; i < 6; i++)
            {
                for(int j = 0; j < 6; j++)
                {
                    Label label = new Label();
                    label.Size = new Size(50, 50);
                    label.Location = new Point(j * 50, i * 50);
                    label.TextAlign = ContentAlignment.MiddleCenter;
                    label.BorderStyle = BorderStyle.Fixed3D;
                    Controls.Add(label);
                    labels[i,j]= label;
                    label.BackColor = Color.White;
                }
            }
        }

        private void ShowForm_Load(object sender, EventArgs e)
        {
            Init();
        }

        public void ShowNumber(int[] number)
        {
            for(int i = 0; i < number.Length; i++)
            {
                int x = i / 6;
                int y = i % 6;
                if (number[i] == 0)
                {
                    labels[x, y].BackColor = Color.White;
                }
                else
                {
                    labels[x, y].BackColor = Color.Black;
                }
            }
        }
    }
}
